﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameLogic : MonoBehaviour
{
    [SerializeField]
    public GameObject ball_prefab;

    [SerializeField]
    public Vector2 gen_center = new Vector2(0, 0);

    [SerializeField]
    public float gen_radius = 100.0f;

    List<GameObject> ball_list = new List<GameObject>();
    float GameStartTime;

    // Start is called before the first frame update
    void Start()
    {
        GameStartTime = Time.time;
    }

    // Update is called once per frame
    void Update()
    {
        if (Time.time - GameStartTime < 5.0f)
        {
            float r = Mathf.Sqrt(Random.Range(0.0f, 1.0f)) * gen_radius;
            float theta = Random.Range(0.0f, 3.1416f * 2.0f);
            Vector3 pos = new Vector3(r * Mathf.Sin(theta), 10.0f, r * Mathf.Cos(theta));
            var ball_instance = Instantiate(ball_prefab, pos, Quaternion.identity);
            ball_list.Add(ball_instance);
        }
    }
}
